/*
 * CompresorUtil.cpp
 *
 *  Created on: 27/11/2009
 *      Author: ngonzalez
 */

#include "CompresorUtil.h"

unsigned int CompresorUtil::calculateLength(unsigned int floor,unsigned int roof){
	return roof - floor;
}

double CompresorUtil::calculateNewFloor(unsigned int roof){
	return roof + 1;
}

double CompresorUtil::calculateNewRoof(long double probability,unsigned int length, unsigned int inicialFloor){
	return (length*probability) + probability + inicialFloor -1;
}


long double CompresorUtil::calculateAcummulateProbability(unsigned int length, unsigned int numero, unsigned int inicialFloor){


	long double resultado;

	double numeroAux = numero;

	long long int lengthLong = length;

	//unsigned int max = ~0;

	resultado = (numeroAux + 1 - inicialFloor) / (lengthLong + 1);

	return resultado;


}
